package com.offcn.user.controller;
import com.offcn.bean.Movietable;
import com.offcn.bean.Performerdetailtable;
import com.offcn.movie.service.MovieService;
import com.offcn.perform.service.PerformerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
 @RequestMapping("/main")
 public class MainController {
     @Resource
     private MovieService movieService;
     @Resource
     private PerformerService performerService;

     @RequestMapping("show-main")
     public String showMain(Model model){
         //查询电影列表
         List<Movietable> movies = movieService.queryMovieList("back");
         //查询演员列表
         List<Performerdetailtable> performers = performerService.queryPerformerList("back");

         model.addAttribute("movies",movies);
         model.addAttribute("performers",performers);
         return "/WEB-INF/jsp/main/main.jsp";
     }

 }

